﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PingPongMain
{
    public class ExceptionHandler : ApplicationException
    {

        private string errorMessage;
        private int startRange;
        private int endRange;

        public string ErrorMessage
        {
            get
            {
                return this.errorMessage;
            }
        }

        public int StartRange
        {
            get
            {
                return this.startRange;
            }
        }
        public int EndRange
        {
            get
            {
                return this.endRange;
            }
        }

        public ExceptionHandler(string message, int startRange, int endRange, Exception innerException)

            : base(message, innerException)
        {
            this.errorMessage = message;
            this.startRange = startRange;
            this.endRange = endRange;
        }

        public ExceptionHandler(string message, int startRange, int endRange)

            : this(message, startRange, endRange, null)
        { }
        public ExceptionHandler(int startRange, int endRange)

            : this(null, startRange, endRange, null)
        { }




        public override string Message
        {
            get
            {

                string result = string.Format("Invalid range exception! The entered value has to be in the interval [{0}...{1}]",
                this.startRange, this.endRange);
                return result;
            }
        }

    }


 }
   
